﻿package mortal.game.view.common.tooltip.tooltips
{
    import Message.Public.*;
    import com.mui.controls.*;
    import com.mui.utils.*;
    import extend.language.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.common.tooltip.*;
    import mortal.game.view.common.tooltip.tooltips.base.*;
    import mortal.game.view.common.tooltip.tooltips.data.*;
    import mortal.game.view.shopMall.view.*;

    public class ToolTipLotteryDrawRareItem extends ToolTipScaleBg
    {
        protected var _titleTxt:GTextFiled;
        protected var _icon:ShopSellItem;
        protected var _itemDescTxt:GTextFiled;
        protected var _playerDescTxt:GTextFiled;
        protected var _itemTxt:GTextFiled;
        protected var _playerTxt:GTextFiled;
        protected var _data:ToolTipLotteryDrawRareItemData;

        public function ToolTipLotteryDrawRareItem()
        {
            this.createChildren();
            return;
        }// end function

        override public function set data(param1) : void
        {
            var _loc_3:ItemData = null;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_2:* = param1 as ToolTipLotteryDrawRareItemData;
            if (_loc_2.itemCode > 0)
            {
                _loc_3 = new ItemData(_loc_2.itemCode);
                this._icon.itemData = _loc_3;
                this._icon.isBind = ItemsUtil.isBind(_loc_3);
            }
            if (_loc_2.money == 0)
            {
                setBg(ToolTipUtil.getBgNameByColor(_loc_3.itemInfo.color));
                if (ItemsUtil.isAllEquipType(_loc_3))
                {
                    this._itemDescTxt.text = Language.getString(20804);
                }
                else
                {
                    this._itemDescTxt.text = Language.getString(20805);
                }
                this._itemTxt.htmlText = ItemsUtil.getItemName(_loc_3);
                this._titleTxt.htmlText = ItemsUtil.getItemWholeName(_loc_3, true);
            }
            else
            {
                _loc_4 = Math.abs(_loc_2.money);
                _loc_5 = _loc_4 * 0.2;
                setBg(ToolTipUtil.getBgNameByColor(EColor._EColorOrange));
                this._itemDescTxt.text = Language.getString(20806);
                this._titleTxt.text = Language.getString(20807);
                if (_loc_2.money > 0)
                {
                    this._itemTxt.text = String(_loc_4);
                }
                else if (_loc_2.money < 0)
                {
                    this._itemTxt.htmlText = String(_loc_4) + "x120%=" + String(int(_loc_4 * 1.2));
                }
            }
            this._playerDescTxt.text = Language.getString(20808);
            this._playerTxt.htmlText = "<font color=\'#ffff00\'>" + _loc_2.playerName + "</font>";
            _scaleBg.setSize(330, 110);
            return;
        }// end function

        protected function createChildren() : void
        {
            this._icon = UICompomentPool.getUICompoment(ShopSellItem);
            this._icon.x = 20;
            this._icon.y = 56;
            this._icon.setItemStyle(ItemStyleConst.Big, ImagesConst.ShopItemBg, 6, 6);
            this.addChild(this._icon);
            this._icon.isShowLock = true;
            this._titleTxt = UIFactory.textField("", 73 + 8, 10, 160, 40, this, GlobalStyle.textFormatHuang2.setSize(16).center().setBold(true));
            this._itemDescTxt = UIFactory.textField("", 118, 65, 100, 20, this);
            this._playerDescTxt = UIFactory.textField("", 118, 95, 100, 20, this);
            this._itemTxt = UIFactory.textField("", 194, 65, 130, 20, this, GlobalStyle.textFormatBai.center());
            this._playerTxt = UIFactory.textField("", 194, 95, 130, 20, this, GlobalStyle.textFormatBai.center());
            return;
        }// end function

    }
}
